﻿using System;

namespace CID.Support
{
    public static class ApplicationDateTime
    {
        private static IApplicationDateTimeProvider Provider = SystemApplicationDateTimeProvider.Instance;

        public static DateTime Now
        {
            get { return Provider.Now; }
        }

        public static DateTime Today
        {
            get { return Provider.Today; }
        }

        public static void SetProvider(IApplicationDateTimeProvider provider)
        {
            if (provider != null) Provider = provider;
            else ResetProvider();
        }

        public static void ResetProvider()
        {
            Provider = SystemApplicationDateTimeProvider.Instance;
        }
    }
}
